package org.example;

import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;

public class ManyContexts 
{
	public static void main(String[] args) throws Exception
	{
		Server server = new Server( 8080 ) ;
		
		ContextHandler hander1 = new ContextHandler() ;
		hander1.setContextPath( "/hello" );
		hander1.setHandler( new HelloHandler("hello") );
		

		ContextHandler hander2 = new ContextHandler() ;
		hander2.setContextPath( "/hander2" );
		hander2.setHandler( new HelloHandler("hander2") );
		

		ContextHandler hander3 = new ContextHandler() ;
		hander3.setContextPath( "/hander3" );
		hander3.setHandler( new HelloHandler("hander3") );
		
		
		ContextHandlerCollection contexts = new ContextHandlerCollection() ;
		contexts.setHandlers( new Handler[]{ hander1, hander2, hander3 });
		
		server.setHandler(contexts);
		
		server.start();
		server.join(); 
	}
}
